<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
  <head>
    <link href="css/style.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="bin/prototype.js"></script>
    <script type="text/javascript" src="bin/functions.js"></script>


    <title> LYON UNO </title>
  </head>

  <body>

    <div id="head_pic">
      <img src="images/title.png" alt="[LYON UNO]" id="picture">
    </div>

    <div id="webpage">

<?php
$hostDB = "localhost";
$userDB = "ampersand";
$passDB = "palomitas";
$dbnameDB = "LYONUNO";

$canalDB = mysql_connect($hostDB, $userDB, $passDB);
$db = mysql_select_db($dbnameDB);
$user = $_COOKIE["loggedIn"];
$consulta = 'select name,message,creator from GAME where ((nick1 = \''.$user.'\' or nick2 = \''.$user.'\' or nick3 = \''.$user.'\') and public_game = \'n\') order by name asc;';

$resDB = mysql_db_query($dbnameDB, $consulta,$canalDB);

echo "<table border = 1>";
echo "<tr><td><h3> Game </h3></td><td><h3> Personal message <h3></td><td><h3> Invited by <h3></td></tr>";
while($row = mysql_fetch_object($resDB)){
	$name = $row->name;
	$pass = $row->message;
	$creator = $row->creator;
	echo "<tr><td><a href=\"waiting.php?game=". $name ."\">" . $name ."</a></td><td><h4>" . $pass . "</h4></td><td>" . $creator . "</td></tr>";
}
echo "</table>";
mysql_free_result($resDB);
mysql_close($canalDB);
?>
<br>
<a href="main.php"> Back to the main page</a>
    </div>

    <div id="foot">
      <address>LYON UNO. CPE <br> 43, boulevard du 11 Novembre 1918. BP 2077 <br> 69616 Villeurbanne Cedex </address>
    </div>
  </body>
</html>
